package Nisha.inheritance.packageB;

import Nisha.inheritance.packageA.*;

public class AccessSpecifierTest extends Parent {

   
	public void printName()
	{
		
		//System.out.println(privateVar); can not be accessed here
		//System.out.println(defaultVar); default can not be accesses in other packages even if subclassed
		System.out.println(protectedVar);
		System.out.println(publicVar);
	}
}

class AccessSpecifierWithoutInheritance
{
	public void printName()
	{
		Parent p = new Parent();
		
		//System.out.println(privateVar); can not be accessed here
		//System.out.println(p.defaultVar); default can not be accesses in other packages even if subclassed
		//System.out.println(p.protectedVar); protected is not visible if not inherited in another package
		System.out.println(p.publicVar); // public is visible everwhere
	}
}
